package weixin.core.controller;

import com.github.sd4324530.fastweixin.api.UserAPI;
import com.github.sd4324530.fastweixin.api.response.GetUserInfoResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import weixin.core.entity.TestEntity;
import weixin.core.service.TestService;

import java.util.List;

/**
 * Created by lxb on 2016/4/13.
 */
@Controller
@RequestMapping("user")
public class UserController {
    private static final Logger LOG  = LoggerFactory.getLogger(UserController.class);
    @Autowired
    private UserAPI userAPI;
    @Autowired
    private TestService testService;
    @RequestMapping("getUserByOpenid")
    @ResponseBody
    public GetUserInfoResponse getUserByOperId(String openid){
        GetUserInfoResponse getUserInfoResponse=userAPI.getUserInfo(openid);
        return getUserInfoResponse;
    }
    @RequestMapping("getInfo")
    @ResponseBody
    public List<TestEntity> getAll(){
        List<TestEntity> testEntities=testService.getInfo();
        return testEntities;
    }

}
